Hi Halil,
In My Project, a User belong to 1 or + OU (Organization Unit).
Entities like "Sales" implements "IMustHaveOU" interface.
public interface IMustHaveOU { public Guid OrgUnitId {get;set;}
[ForeingKey("OrgUnitId")] public OrgUnit OrgUnit {get;set;} }
I want to create a DynamicFilter to filter entity that implement this interface using OU's from Current User (AbpSession).
So, I extend "User" class
public class User : AbpUser<Tenant, User> { public virtual ICollection<OrgUnit> OrgUnits{ get; set; } //List of OU that user belongs
public virtual ICollection OUIds{ get; set; } //List of OU Id's that user belongs
}
The question is?
How can i get User navigation from AbpSession?
How can i use AbpSession.User.OrgUnits (List) on Dynamic filter?
protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Filter("OuFilter", (IMustHaveOU entity) => AbpSession.User.OUList.Contains(entity.OrgUnitId), null);
or
modelBuilder.Filter("OuFilter", (IMustHaveOU entity,, List placeList) =>placeList.Contains(p.PlaceId), () => AbpSession.User.OUIds);
}
Is this a good approach? this will create a "IN" clause on SQL?
Can i extend properties on AbpSession?
Can i use LINQ JOIN in DynamicFilter?
Thanks
Vitor Lacerda
Hi,
How can i use Property Injection at InitialDataBuilder (DBMigration Seed)?
For example, how can i user Logger class?
public ILogger Logger { get; set; }
Thanks,
Vitor Lacerda